﻿using System.ComponentModel.DataAnnotations;
using OpusSuite.Globalisation.Attributes;
using OpusSuite.Models.Model.Shared;
using OpusSuite.Utility;

namespace OpusSuite.Models.Model.WebAdmin
{
    [Table("userprofilesetting")]
    public class UserProfileSetting : ModelBase
    {
        [Key]
        public int UserProfileSettingId { get; set; }

        [Required]
        public int TypeValue { get; set; }
        public Enums.SettingType Type
        {
            get { return (Enums.SettingType)TypeValue; }
            set { TypeValue = (int)value; }
        }

        [Required]
        [StringLength(256)]
        public string Value { get; set; }

        // TODO Security
        // Controller / Action

        public bool IsBoolean
        {
            get { return Value == "True" || Value == "False"; }
        }

    }
}

